import request from '@/router/axios';

/**
 * 获取全部游戏列表
 * @returns {AxiosPromise}
 */
export const getGameProjectAll = () => {
  return request({
    url: '/api/blade-game/gameproject/all',
    method: 'get'
  })
}


/**
 * 获取游戏资源
 * @returns {AxiosPromise}
 */
export const getGameList = (current, size, params) => {
  return request({
    url: '/api/blade-game/gamepromote/readData',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/**
 * 获取我的游戏资源
 * @returns {AxiosPromise}
 */
export const getMyGameList = (current, size, params) => {
  return request({
    url: '/api/blade-game/gamepromote/myReadData',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/**
 * 添加推广员游戏资源包
 * @param current
 * @param size
 * @param params
 * @returns {AxiosPromise}
 */
export const addGamePromote = (userId, gameId) => {
  return request({
    url: '/api/blade-game/gamepromote/add',
    method: 'get',
    params: {
      userId,
      gameId
    }
  })
}

/**
 * 下架推广员游戏资源包
 * @param current
 * @param size
 * @param params
 * @returns {AxiosPromise}
 */
export const offShelfGamePromote = (userId, gameId) => {
  return request({
    url: '/api/blade-game/gamepromote/offShelf',
    method: 'get',
    params: {
      userId,
      gameId
    }
  })
}

/**
 * 推广员申请分包
 * @param current
 * @param size
 * @param params
 * @returns {AxiosPromise}
 */
export const subcontractGamePromote = (userId, gameId) => {
  return request({
    url: '/api/blade-game/gamepromote/subcontract',
    method: 'get',
    params: {
      userId,
      gameId
    }
  })
}

/**
 * 游戏资源包轮播图
 * @param current
 * @param size
 * @param params
 * @returns {AxiosPromise}
 */
export const gameImgList = (gameId) => {
  return request({
    url: '/api/blade-game/gameimg/list',
    method: 'get',
    params: {
      gameId
    }
  })
}


/**
 * 根据code获取下载链接
 * @param current
 * @param size
 * @param params
 * @returns {AxiosPromise}
 */
export const getGamePathByCode = (code, osType) => {
  return request({
    url: '/api/blade-game/gamepromote/getGamePathByCode',
    method: 'get',
    params: {
      code,
      osType
    }
  })
}

export const resetSubcontract = (params) => {
  return request({
    url: '/api/blade-game/gamepromote/resetSubcontract',
    method: 'get',
    params: {
      ...params
    }
  })
}



export const setGameSx = (game) => {
  return request({
    url: '/api/blade-game/gamepromote/setGameSx',
    method: 'post',
    data:game
  })
}

export const getGameDownLoadUrl = (game) => {
  return request({
    url: '/api/blade-game/gamepromote/getGameDownLoadUrl',
    method: 'post',
    data:game
  })
}
